package cn.shadow.account.controller;

import cn.shadow.account.model.DeductDto;
import cn.shadow.account.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Random;

/**
 * @author 冯啸迪
 */
@RestController
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private IAccountService accountService;

    @PutMapping("/new")
    public int createAccount(){
        return accountService.insertAccount();
    }

    @PostMapping("/deduct")
    public int deductBalance(@RequestBody DeductDto deductDto){

        return accountService.deductBalance(deductDto);
    }


}
